package com.example.letgo.story;

import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;
import android.view.View;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.letgo.Fragment.PersoncenterFragment;
import com.example.letgo.HomeActivity;
import com.example.letgo.R;
import com.example.letgo.model.Story;
import com.example.letgo.model.Team;
import com.google.gson.Gson;

import java.io.File;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class StoryReleaseSuccess extends AppCompatActivity {
    String storyJson;
    @BindView(R.id.return_person)
    RelativeLayout returnPerson;
    @BindView(R.id.ImagS)
    ImageView ImagS;
    @BindView(R.id.content_describe)
    TextView content;
    @BindView(R.id.in_details)
    RelativeLayout inDetails;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_story_release_success);
        ButterKnife.bind(this);

        storyJson = getIntent().getStringExtra("story");
        Story story = new Gson().fromJson(storyJson, Story.class);
        Log.e("Tag:team", story.getStoryDescribe());

        ImagS.setImageURI(Uri.fromFile(new File(story.getStoryImg1())));

        content.setText(story.getStoryDescribe().toString().trim());
    }

    @OnClick({R.id.return_person, R.id.in_details})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.return_person:
                Intent intent = new Intent(StoryReleaseSuccess.this, HomeActivity.class);
                startActivity(intent);
                finish();
                break;
                }
    }
}
